package com.sskj.gocoin.p.fragment;

import com.lzy.okgo.OkGo;
import com.lzy.okrx2.adapter.FlowableBody;
import com.sskj.gocoin.MyAppLication;
import com.sskj.gocoin.m.HttpConfig;
import com.sskj.gocoin.m.bean.FabiListBean;
import com.sskj.gocoin.m.bean.FabiPublishListBean;
import com.sskj.gocoin.m.bean.HaiPageBean;
import com.sskj.gocoin.m.bean.HttpData;
import com.sskj.gocoin.m.http.JsonConverter;
import com.sskj.gocoin.p.base.BasePresenter;
import com.sskj.gocoin.v.fragment.FabiRecordFragment;

import java.util.List;

import io.reactivex.Flowable;

public class FabiRecordPresenter extends BasePresenter<FabiRecordFragment> {

    public Flowable<List<FabiPublishListBean>> getData(int page) {
        return OkGo.<HttpData<HaiPageBean<FabiPublishListBean>>>get(HttpConfig.BASE_URL + HttpConfig.MARKET_ORDER_LIST)
                .params("p", page)
                .params("size", 15)
                .converter(new JsonConverter<HttpData<HaiPageBean<FabiPublishListBean>>>() {
                })
                .adapt(new FlowableBody<>())
                .map(haiPageBeanHttpData -> haiPageBeanHttpData.getData().getRes());
    }


}
